<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the TablePrivateMessage class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single TablePrivateMessage object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a TablePrivateMessageMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 * 
	 * @package My Application
	 * @subpackage MetaControls
	 * property-read TablePrivateMessage $TablePrivateMessage the actual TablePrivateMessage data class being edited
	 * property QLabel $IdControl
	 * property-read QLabel $IdLabel
	 * property QListBox $UserIdFromControl
	 * property-read QLabel $UserIdFromLabel
	 * property QListBox $UserIdToControl
	 * property-read QLabel $UserIdToLabel
	 * property QListBox $ProjectIdControl
	 * property-read QLabel $ProjectIdLabel
	 * property QTextBox $MessageControl
	 * property-read QLabel $MessageLabel
	 * property QDateTimePicker $MessageDateControl
	 * property-read QLabel $MessageDateLabel
	 * property QTextBox $MessageOpenedControl
	 * property-read QLabel $MessageOpenedLabel
	 * property QDateTimePicker $OpenedDateControl
	 * property-read QLabel $OpenedDateLabel
	 * property QIntegerTextBox $AttachmentIdControl
	 * property-read QLabel $AttachmentIdLabel
	 * property QTextBox $DeleteAttachmentControl
	 * property-read QLabel $DeleteAttachmentLabel
	 * property QTextBox $TitleControl
	 * property-read QLabel $TitleLabel
	 * property QIntegerTextBox $TitleTypeControl
	 * property-read QLabel $TitleTypeLabel
	 * property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class TablePrivateMessageMetaControlGen extends QBaseClass {
		// General Variables
		protected $objTablePrivateMessage;
		protected $objParentObject;
		protected $strTitleVerb;
		protected $blnEditMode;

		// Controls that allow the editing of TablePrivateMessage's individual data fields
		protected $lblId;
		protected $lstUserIdFromObject;
		protected $lstUserIdToObject;
		protected $lstProject;
		protected $txtMessage;
		protected $calMessageDate;
		protected $txtMessageOpened;
		protected $calOpenedDate;
		protected $txtAttachmentId;
		protected $txtDeleteAttachment;
		protected $txtTitle;
		protected $txtTitleType;

		// Controls that allow the viewing of TablePrivateMessage's individual data fields
		protected $lblUserIdFrom;
		protected $lblUserIdTo;
		protected $lblProjectId;
		protected $lblMessage;
		protected $lblMessageDate;
		protected $lblMessageOpened;
		protected $lblOpenedDate;
		protected $lblAttachmentId;
		protected $lblDeleteAttachment;
		protected $lblTitle;
		protected $lblTitleType;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * TablePrivateMessageMetaControl to edit a single TablePrivateMessage object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single TablePrivateMessage object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TablePrivateMessageMetaControl
		 * @param TablePrivateMessage $objTablePrivateMessage new or existing TablePrivateMessage object
		 */
		 public function __construct($objParentObject, TablePrivateMessage $objTablePrivateMessage) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this TablePrivateMessageMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked TablePrivateMessage object
			$this->objTablePrivateMessage = $objTablePrivateMessage;

			// Figure out if we're Editing or Creating New
			if ($this->objTablePrivateMessage->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
		 * edit, or if we are also allowed to create a new one, etc.
		 * 
		 * @param mixed $objParentObject QForm or QPanel which will be using this TablePrivateMessageMetaControl
		 * @param integer $intId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing TablePrivateMessage object creation - defaults to CreateOrEdit
 		 * @return TablePrivateMessageMetaControl
		 */
		public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intId)) {
				$objTablePrivateMessage = TablePrivateMessage::Load($intId);

				// TablePrivateMessage was found -- return it!
				if ($objTablePrivateMessage)
					return new TablePrivateMessageMetaControl($objParentObject, $objTablePrivateMessage);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a TablePrivateMessage object with PK arguments: ' . $intId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new TablePrivateMessageMetaControl($objParentObject, new TablePrivateMessage());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TablePrivateMessageMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing TablePrivateMessage object creation - defaults to CreateOrEdit
		 * @return TablePrivateMessageMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::PathInfo(0);
			return TablePrivateMessageMetaControl::Create($objParentObject, $intId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TablePrivateMessageMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing TablePrivateMessage object creation - defaults to CreateOrEdit
		 * @return TablePrivateMessageMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::QueryString('intId');
			return TablePrivateMessageMetaControl::Create($objParentObject, $intId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QLabel lblId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblId_Create($strControlId = null) {
			$this->lblId = new QLabel($this->objParentObject, $strControlId);
			$this->lblId->Name = QApplication::Translate('Id');
			if ($this->blnEditMode)
				$this->lblId->Text = $this->objTablePrivateMessage->Id;
			else
				$this->lblId->Text = 'N/A';
			return $this->lblId;
		}

		/**
		 * Create and setup QListBox lstUserIdFromObject
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstUserIdFromObject_Create($strControlId = null) {
			$this->lstUserIdFromObject = new QListBox($this->objParentObject, $strControlId);
			$this->lstUserIdFromObject->Name = QApplication::Translate('User Id From Object');
			$this->lstUserIdFromObject->Required = true;
			if (!$this->blnEditMode)
				$this->lstUserIdFromObject->AddItem(QApplication::Translate('- Select One -'), null);
			$objUserIdFromObjectArray = TableUserProject::LoadAll();
			if ($objUserIdFromObjectArray) foreach ($objUserIdFromObjectArray as $objUserIdFromObject) {
				$objListItem = new QListItem($objUserIdFromObject->__toString(), $objUserIdFromObject->Id);
				if (($this->objTablePrivateMessage->UserIdFromObject) && ($this->objTablePrivateMessage->UserIdFromObject->Id == $objUserIdFromObject->Id))
					$objListItem->Selected = true;
				$this->lstUserIdFromObject->AddItem($objListItem);
			}
			return $this->lstUserIdFromObject;
		}

		/**
		 * Create and setup QLabel lblUserIdFrom
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblUserIdFrom_Create($strControlId = null) {
			$this->lblUserIdFrom = new QLabel($this->objParentObject, $strControlId);
			$this->lblUserIdFrom->Name = QApplication::Translate('User Id From Object');
			$this->lblUserIdFrom->Text = ($this->objTablePrivateMessage->UserIdFromObject) ? $this->objTablePrivateMessage->UserIdFromObject->__toString() : null;
			$this->lblUserIdFrom->Required = true;
			return $this->lblUserIdFrom;
		}

		/**
		 * Create and setup QListBox lstUserIdToObject
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstUserIdToObject_Create($strControlId = null) {
			$this->lstUserIdToObject = new QListBox($this->objParentObject, $strControlId);
			$this->lstUserIdToObject->Name = QApplication::Translate('User Id To Object');
			$this->lstUserIdToObject->Required = true;
			if (!$this->blnEditMode)
				$this->lstUserIdToObject->AddItem(QApplication::Translate('- Select One -'), null);
			$objUserIdToObjectArray = TableUserProject::LoadAll();
			if ($objUserIdToObjectArray) foreach ($objUserIdToObjectArray as $objUserIdToObject) {
				$objListItem = new QListItem($objUserIdToObject->__toString(), $objUserIdToObject->Id);
				if (($this->objTablePrivateMessage->UserIdToObject) && ($this->objTablePrivateMessage->UserIdToObject->Id == $objUserIdToObject->Id))
					$objListItem->Selected = true;
				$this->lstUserIdToObject->AddItem($objListItem);
			}
			return $this->lstUserIdToObject;
		}

		/**
		 * Create and setup QLabel lblUserIdTo
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblUserIdTo_Create($strControlId = null) {
			$this->lblUserIdTo = new QLabel($this->objParentObject, $strControlId);
			$this->lblUserIdTo->Name = QApplication::Translate('User Id To Object');
			$this->lblUserIdTo->Text = ($this->objTablePrivateMessage->UserIdToObject) ? $this->objTablePrivateMessage->UserIdToObject->__toString() : null;
			$this->lblUserIdTo->Required = true;
			return $this->lblUserIdTo;
		}

		/**
		 * Create and setup QListBox lstProject
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstProject_Create($strControlId = null) {
			$this->lstProject = new QListBox($this->objParentObject, $strControlId);
			$this->lstProject->Name = QApplication::Translate('Project');
			$this->lstProject->Required = true;
			if (!$this->blnEditMode)
				$this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
			$objProjectArray = TableProject::LoadAll();
			if ($objProjectArray) foreach ($objProjectArray as $objProject) {
				$objListItem = new QListItem($objProject->__toString(), $objProject->Id);
				if (($this->objTablePrivateMessage->Project) && ($this->objTablePrivateMessage->Project->Id == $objProject->Id))
					$objListItem->Selected = true;
				$this->lstProject->AddItem($objListItem);
			}
			return $this->lstProject;
		}

		/**
		 * Create and setup QLabel lblProjectId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblProjectId_Create($strControlId = null) {
			$this->lblProjectId = new QLabel($this->objParentObject, $strControlId);
			$this->lblProjectId->Name = QApplication::Translate('Project');
			$this->lblProjectId->Text = ($this->objTablePrivateMessage->Project) ? $this->objTablePrivateMessage->Project->__toString() : null;
			$this->lblProjectId->Required = true;
			return $this->lblProjectId;
		}

		/**
		 * Create and setup QTextBox txtMessage
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtMessage_Create($strControlId = null) {
			$this->txtMessage = new QTextBox($this->objParentObject, $strControlId);
			$this->txtMessage->Name = QApplication::Translate('Message');
			$this->txtMessage->Text = $this->objTablePrivateMessage->Message;
			$this->txtMessage->TextMode = QTextMode::MultiLine;
			return $this->txtMessage;
		}

		/**
		 * Create and setup QLabel lblMessage
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblMessage_Create($strControlId = null) {
			$this->lblMessage = new QLabel($this->objParentObject, $strControlId);
			$this->lblMessage->Name = QApplication::Translate('Message');
			$this->lblMessage->Text = $this->objTablePrivateMessage->Message;
			return $this->lblMessage;
		}

		/**
		 * Create and setup QDateTimePicker calMessageDate
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calMessageDate_Create($strControlId = null) {
			$this->calMessageDate = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calMessageDate->Name = QApplication::Translate('Message Date');
			$this->calMessageDate->DateTime = $this->objTablePrivateMessage->MessageDate;
			$this->calMessageDate->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calMessageDate;
		}

		/**
		 * Create and setup QLabel lblMessageDate
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblMessageDate_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblMessageDate = new QLabel($this->objParentObject, $strControlId);
			$this->lblMessageDate->Name = QApplication::Translate('Message Date');
			$this->strMessageDateDateTimeFormat = $strDateTimeFormat;
			$this->lblMessageDate->Text = sprintf($this->objTablePrivateMessage->MessageDate) ? $this->objTablePrivateMessage->MessageDate->__toString($this->strMessageDateDateTimeFormat) : null;
			return $this->lblMessageDate;
		}

		protected $strMessageDateDateTimeFormat;


		/**
		 * Create and setup QTextBox txtMessageOpened
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtMessageOpened_Create($strControlId = null) {
			$this->txtMessageOpened = new QTextBox($this->objParentObject, $strControlId);
			$this->txtMessageOpened->Name = QApplication::Translate('Message Opened');
			$this->txtMessageOpened->Text = $this->objTablePrivateMessage->MessageOpened;
			$this->txtMessageOpened->Required = true;
			$this->txtMessageOpened->MaxLength = TablePrivateMessage::MessageOpenedMaxLength;
			return $this->txtMessageOpened;
		}

		/**
		 * Create and setup QLabel lblMessageOpened
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblMessageOpened_Create($strControlId = null) {
			$this->lblMessageOpened = new QLabel($this->objParentObject, $strControlId);
			$this->lblMessageOpened->Name = QApplication::Translate('Message Opened');
			$this->lblMessageOpened->Text = $this->objTablePrivateMessage->MessageOpened;
			$this->lblMessageOpened->Required = true;
			return $this->lblMessageOpened;
		}

		/**
		 * Create and setup QDateTimePicker calOpenedDate
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calOpenedDate_Create($strControlId = null) {
			$this->calOpenedDate = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calOpenedDate->Name = QApplication::Translate('Opened Date');
			$this->calOpenedDate->DateTime = $this->objTablePrivateMessage->OpenedDate;
			$this->calOpenedDate->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calOpenedDate;
		}

		/**
		 * Create and setup QLabel lblOpenedDate
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblOpenedDate_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblOpenedDate = new QLabel($this->objParentObject, $strControlId);
			$this->lblOpenedDate->Name = QApplication::Translate('Opened Date');
			$this->strOpenedDateDateTimeFormat = $strDateTimeFormat;
			$this->lblOpenedDate->Text = sprintf($this->objTablePrivateMessage->OpenedDate) ? $this->objTablePrivateMessage->OpenedDate->__toString($this->strOpenedDateDateTimeFormat) : null;
			return $this->lblOpenedDate;
		}

		protected $strOpenedDateDateTimeFormat;


		/**
		 * Create and setup QIntegerTextBox txtAttachmentId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtAttachmentId_Create($strControlId = null) {
			$this->txtAttachmentId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtAttachmentId->Name = QApplication::Translate('Attachment Id');
			$this->txtAttachmentId->Text = $this->objTablePrivateMessage->AttachmentId;
			return $this->txtAttachmentId;
		}

		/**
		 * Create and setup QLabel lblAttachmentId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblAttachmentId_Create($strControlId = null, $strFormat = null) {
			$this->lblAttachmentId = new QLabel($this->objParentObject, $strControlId);
			$this->lblAttachmentId->Name = QApplication::Translate('Attachment Id');
			$this->lblAttachmentId->Text = $this->objTablePrivateMessage->AttachmentId;
			$this->lblAttachmentId->Format = $strFormat;
			return $this->lblAttachmentId;
		}

		/**
		 * Create and setup QTextBox txtDeleteAttachment
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtDeleteAttachment_Create($strControlId = null) {
			$this->txtDeleteAttachment = new QTextBox($this->objParentObject, $strControlId);
			$this->txtDeleteAttachment->Name = QApplication::Translate('Delete Attachment');
			$this->txtDeleteAttachment->Text = $this->objTablePrivateMessage->DeleteAttachment;
			$this->txtDeleteAttachment->MaxLength = TablePrivateMessage::DeleteAttachmentMaxLength;
			return $this->txtDeleteAttachment;
		}

		/**
		 * Create and setup QLabel lblDeleteAttachment
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblDeleteAttachment_Create($strControlId = null) {
			$this->lblDeleteAttachment = new QLabel($this->objParentObject, $strControlId);
			$this->lblDeleteAttachment->Name = QApplication::Translate('Delete Attachment');
			$this->lblDeleteAttachment->Text = $this->objTablePrivateMessage->DeleteAttachment;
			return $this->lblDeleteAttachment;
		}

		/**
		 * Create and setup QTextBox txtTitle
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtTitle_Create($strControlId = null) {
			$this->txtTitle = new QTextBox($this->objParentObject, $strControlId);
			$this->txtTitle->Name = QApplication::Translate('Title');
			$this->txtTitle->Text = $this->objTablePrivateMessage->Title;
			$this->txtTitle->Required = true;
			$this->txtTitle->MaxLength = TablePrivateMessage::TitleMaxLength;
			return $this->txtTitle;
		}

		/**
		 * Create and setup QLabel lblTitle
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblTitle_Create($strControlId = null) {
			$this->lblTitle = new QLabel($this->objParentObject, $strControlId);
			$this->lblTitle->Name = QApplication::Translate('Title');
			$this->lblTitle->Text = $this->objTablePrivateMessage->Title;
			$this->lblTitle->Required = true;
			return $this->lblTitle;
		}

		/**
		 * Create and setup QIntegerTextBox txtTitleType
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtTitleType_Create($strControlId = null) {
			$this->txtTitleType = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtTitleType->Name = QApplication::Translate('Title Type');
			$this->txtTitleType->Text = $this->objTablePrivateMessage->TitleType;
			$this->txtTitleType->Required = true;
			return $this->txtTitleType;
		}

		/**
		 * Create and setup QLabel lblTitleType
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblTitleType_Create($strControlId = null, $strFormat = null) {
			$this->lblTitleType = new QLabel($this->objParentObject, $strControlId);
			$this->lblTitleType->Name = QApplication::Translate('Title Type');
			$this->lblTitleType->Text = $this->objTablePrivateMessage->TitleType;
			$this->lblTitleType->Required = true;
			$this->lblTitleType->Format = $strFormat;
			return $this->lblTitleType;
		}



		/**
		 * Refresh this MetaControl with Data from the local TablePrivateMessage object.
		 * @param boolean $blnReload reload TablePrivateMessage from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objTablePrivateMessage->Reload();

			if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objTablePrivateMessage->Id;

			if ($this->lstUserIdFromObject) {
					$this->lstUserIdFromObject->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstUserIdFromObject->AddItem(QApplication::Translate('- Select One -'), null);
				$objUserIdFromObjectArray = TableUserProject::LoadAll();
				if ($objUserIdFromObjectArray) foreach ($objUserIdFromObjectArray as $objUserIdFromObject) {
					$objListItem = new QListItem($objUserIdFromObject->__toString(), $objUserIdFromObject->Id);
					if (($this->objTablePrivateMessage->UserIdFromObject) && ($this->objTablePrivateMessage->UserIdFromObject->Id == $objUserIdFromObject->Id))
						$objListItem->Selected = true;
					$this->lstUserIdFromObject->AddItem($objListItem);
				}
			}
			if ($this->lblUserIdFrom) $this->lblUserIdFrom->Text = ($this->objTablePrivateMessage->UserIdFromObject) ? $this->objTablePrivateMessage->UserIdFromObject->__toString() : null;

			if ($this->lstUserIdToObject) {
					$this->lstUserIdToObject->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstUserIdToObject->AddItem(QApplication::Translate('- Select One -'), null);
				$objUserIdToObjectArray = TableUserProject::LoadAll();
				if ($objUserIdToObjectArray) foreach ($objUserIdToObjectArray as $objUserIdToObject) {
					$objListItem = new QListItem($objUserIdToObject->__toString(), $objUserIdToObject->Id);
					if (($this->objTablePrivateMessage->UserIdToObject) && ($this->objTablePrivateMessage->UserIdToObject->Id == $objUserIdToObject->Id))
						$objListItem->Selected = true;
					$this->lstUserIdToObject->AddItem($objListItem);
				}
			}
			if ($this->lblUserIdTo) $this->lblUserIdTo->Text = ($this->objTablePrivateMessage->UserIdToObject) ? $this->objTablePrivateMessage->UserIdToObject->__toString() : null;

			if ($this->lstProject) {
					$this->lstProject->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
				$objProjectArray = TableProject::LoadAll();
				if ($objProjectArray) foreach ($objProjectArray as $objProject) {
					$objListItem = new QListItem($objProject->__toString(), $objProject->Id);
					if (($this->objTablePrivateMessage->Project) && ($this->objTablePrivateMessage->Project->Id == $objProject->Id))
						$objListItem->Selected = true;
					$this->lstProject->AddItem($objListItem);
				}
			}
			if ($this->lblProjectId) $this->lblProjectId->Text = ($this->objTablePrivateMessage->Project) ? $this->objTablePrivateMessage->Project->__toString() : null;

			if ($this->txtMessage) $this->txtMessage->Text = $this->objTablePrivateMessage->Message;
			if ($this->lblMessage) $this->lblMessage->Text = $this->objTablePrivateMessage->Message;

			if ($this->calMessageDate) $this->calMessageDate->DateTime = $this->objTablePrivateMessage->MessageDate;
			if ($this->lblMessageDate) $this->lblMessageDate->Text = sprintf($this->objTablePrivateMessage->MessageDate) ? $this->objTablePrivateMessage->MessageDate->__toString($this->strMessageDateDateTimeFormat) : null;

			if ($this->txtMessageOpened) $this->txtMessageOpened->Text = $this->objTablePrivateMessage->MessageOpened;
			if ($this->lblMessageOpened) $this->lblMessageOpened->Text = $this->objTablePrivateMessage->MessageOpened;

			if ($this->calOpenedDate) $this->calOpenedDate->DateTime = $this->objTablePrivateMessage->OpenedDate;
			if ($this->lblOpenedDate) $this->lblOpenedDate->Text = sprintf($this->objTablePrivateMessage->OpenedDate) ? $this->objTablePrivateMessage->OpenedDate->__toString($this->strOpenedDateDateTimeFormat) : null;

			if ($this->txtAttachmentId) $this->txtAttachmentId->Text = $this->objTablePrivateMessage->AttachmentId;
			if ($this->lblAttachmentId) $this->lblAttachmentId->Text = $this->objTablePrivateMessage->AttachmentId;

			if ($this->txtDeleteAttachment) $this->txtDeleteAttachment->Text = $this->objTablePrivateMessage->DeleteAttachment;
			if ($this->lblDeleteAttachment) $this->lblDeleteAttachment->Text = $this->objTablePrivateMessage->DeleteAttachment;

			if ($this->txtTitle) $this->txtTitle->Text = $this->objTablePrivateMessage->Title;
			if ($this->lblTitle) $this->lblTitle->Text = $this->objTablePrivateMessage->Title;

			if ($this->txtTitleType) $this->txtTitleType->Text = $this->objTablePrivateMessage->TitleType;
			if ($this->lblTitleType) $this->lblTitleType->Text = $this->objTablePrivateMessage->TitleType;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC TABLEPRIVATEMESSAGE OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's TablePrivateMessage instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveTablePrivateMessage() {
			try {
				// Update any fields for controls that have been created
				if ($this->lstUserIdFromObject) $this->objTablePrivateMessage->UserIdFrom = $this->lstUserIdFromObject->SelectedValue;
				if ($this->lstUserIdToObject) $this->objTablePrivateMessage->UserIdTo = $this->lstUserIdToObject->SelectedValue;
				if ($this->lstProject) $this->objTablePrivateMessage->ProjectId = $this->lstProject->SelectedValue;
				if ($this->txtMessage) $this->objTablePrivateMessage->Message = $this->txtMessage->Text;
				if ($this->calMessageDate) $this->objTablePrivateMessage->MessageDate = $this->calMessageDate->DateTime;
				if ($this->txtMessageOpened) $this->objTablePrivateMessage->MessageOpened = $this->txtMessageOpened->Text;
				if ($this->calOpenedDate) $this->objTablePrivateMessage->OpenedDate = $this->calOpenedDate->DateTime;
				if ($this->txtAttachmentId) $this->objTablePrivateMessage->AttachmentId = $this->txtAttachmentId->Text;
				if ($this->txtDeleteAttachment) $this->objTablePrivateMessage->DeleteAttachment = $this->txtDeleteAttachment->Text;
				if ($this->txtTitle) $this->objTablePrivateMessage->Title = $this->txtTitle->Text;
				if ($this->txtTitleType) $this->objTablePrivateMessage->TitleType = $this->txtTitleType->Text;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the TablePrivateMessage object
				$this->objTablePrivateMessage->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's TablePrivateMessage instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteTablePrivateMessage() {
			$this->objTablePrivateMessage->Delete();
		}		



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'TablePrivateMessage': return $this->objTablePrivateMessage;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to TablePrivateMessage fields -- will be created dynamically if not yet created
				case 'IdControl':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'IdLabel':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'UserIdFromControl':
					if (!$this->lstUserIdFromObject) return $this->lstUserIdFromObject_Create();
					return $this->lstUserIdFromObject;
				case 'UserIdFromLabel':
					if (!$this->lblUserIdFrom) return $this->lblUserIdFrom_Create();
					return $this->lblUserIdFrom;
				case 'UserIdToControl':
					if (!$this->lstUserIdToObject) return $this->lstUserIdToObject_Create();
					return $this->lstUserIdToObject;
				case 'UserIdToLabel':
					if (!$this->lblUserIdTo) return $this->lblUserIdTo_Create();
					return $this->lblUserIdTo;
				case 'ProjectIdControl':
					if (!$this->lstProject) return $this->lstProject_Create();
					return $this->lstProject;
				case 'ProjectIdLabel':
					if (!$this->lblProjectId) return $this->lblProjectId_Create();
					return $this->lblProjectId;
				case 'MessageControl':
					if (!$this->txtMessage) return $this->txtMessage_Create();
					return $this->txtMessage;
				case 'MessageLabel':
					if (!$this->lblMessage) return $this->lblMessage_Create();
					return $this->lblMessage;
				case 'MessageDateControl':
					if (!$this->calMessageDate) return $this->calMessageDate_Create();
					return $this->calMessageDate;
				case 'MessageDateLabel':
					if (!$this->lblMessageDate) return $this->lblMessageDate_Create();
					return $this->lblMessageDate;
				case 'MessageOpenedControl':
					if (!$this->txtMessageOpened) return $this->txtMessageOpened_Create();
					return $this->txtMessageOpened;
				case 'MessageOpenedLabel':
					if (!$this->lblMessageOpened) return $this->lblMessageOpened_Create();
					return $this->lblMessageOpened;
				case 'OpenedDateControl':
					if (!$this->calOpenedDate) return $this->calOpenedDate_Create();
					return $this->calOpenedDate;
				case 'OpenedDateLabel':
					if (!$this->lblOpenedDate) return $this->lblOpenedDate_Create();
					return $this->lblOpenedDate;
				case 'AttachmentIdControl':
					if (!$this->txtAttachmentId) return $this->txtAttachmentId_Create();
					return $this->txtAttachmentId;
				case 'AttachmentIdLabel':
					if (!$this->lblAttachmentId) return $this->lblAttachmentId_Create();
					return $this->lblAttachmentId;
				case 'DeleteAttachmentControl':
					if (!$this->txtDeleteAttachment) return $this->txtDeleteAttachment_Create();
					return $this->txtDeleteAttachment;
				case 'DeleteAttachmentLabel':
					if (!$this->lblDeleteAttachment) return $this->lblDeleteAttachment_Create();
					return $this->lblDeleteAttachment;
				case 'TitleControl':
					if (!$this->txtTitle) return $this->txtTitle_Create();
					return $this->txtTitle;
				case 'TitleLabel':
					if (!$this->lblTitle) return $this->lblTitle_Create();
					return $this->lblTitle;
				case 'TitleTypeControl':
					if (!$this->txtTitleType) return $this->txtTitleType_Create();
					return $this->txtTitleType;
				case 'TitleTypeLabel':
					if (!$this->lblTitleType) return $this->lblTitleType_Create();
					return $this->lblTitleType;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to TablePrivateMessage fields
					case 'IdControl':
						return ($this->lblId = QType::Cast($mixValue, 'QControl'));
					case 'UserIdFromControl':
						return ($this->lstUserIdFromObject = QType::Cast($mixValue, 'QControl'));
					case 'UserIdToControl':
						return ($this->lstUserIdToObject = QType::Cast($mixValue, 'QControl'));
					case 'ProjectIdControl':
						return ($this->lstProject = QType::Cast($mixValue, 'QControl'));
					case 'MessageControl':
						return ($this->txtMessage = QType::Cast($mixValue, 'QControl'));
					case 'MessageDateControl':
						return ($this->calMessageDate = QType::Cast($mixValue, 'QControl'));
					case 'MessageOpenedControl':
						return ($this->txtMessageOpened = QType::Cast($mixValue, 'QControl'));
					case 'OpenedDateControl':
						return ($this->calOpenedDate = QType::Cast($mixValue, 'QControl'));
					case 'AttachmentIdControl':
						return ($this->txtAttachmentId = QType::Cast($mixValue, 'QControl'));
					case 'DeleteAttachmentControl':
						return ($this->txtDeleteAttachment = QType::Cast($mixValue, 'QControl'));
					case 'TitleControl':
						return ($this->txtTitle = QType::Cast($mixValue, 'QControl'));
					case 'TitleTypeControl':
						return ($this->txtTitleType = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>